import pymssql  # 引入pymssql模块
import pandas as pd


def conn():
    return pymssql.connect('localhost', 'sa', 'fjl201314', 'GeoGuiYang', charset='GBK')  # 服务器名,账户,密码,数据库名


def main():
    connect = conn();
    if connect:
        print("连接成功!")
        cursor = connect.cursor()
        sql = '''
           SELECT
           *
           FROM Ageo_RemoteSenseData
           '''
        cursor.execute(sql)
        row = cursor.fetchall()
        for i in row:
            print(i)
        # print(pd.DataFrame(list(row)))
        # connect.commit()  # 提交
        cursor.close()  # 关闭游标
        connect.close()  # 关闭连接


if __name__ == '__main__':
    main()
